package com.thiswhyme.discovery.server1.v1.controller;

import com.thiswhyme.common.response.ResponseVo;
import com.thiswhyme.discovery.server1.v2.controller.dto.UserDto;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * Created by thiswhyme on 2020/9/3.
 */
@RestController
@RequestMapping("/user1/")
public class UserController {

    @GetMapping("user-list")
    public ResponseVo<List<UserDto>> listUserInfo(@RequestParam String trace) {
        trace = trace + "-> server1-v1";
        return ResponseVo.success(Arrays.asList(new UserDto().setUserId(333).setName(trace)));
    }

    @GetMapping("user-name")
    public ResponseVo<String> queryUserName(@RequestParam String trace) {
        trace = trace + "-> server1-v1";
        return ResponseVo.success(trace);
    }
}
